#  Name:		output
#  Purpose:     Reads library items and converts them
#               into output readable for another
#               programming languages.
#  Version:		0.2
#  Part Of:		linuxrules
#  Creation:	Thu Oct 21 2010, 14:59:59
#  Modified:	Sun Nov 21 2010, 13:06:00
#
#  See COPYING for linuxrules GPL3 licensing info.

BEGIN {
# Future switch for interchangeable output
    _translate = "POSIXSHELL"

# COPY INTO A CONVENIENT SINGLE INDEX (read fully)
# It is ugly but AWK doesn't have introspection
# as far as I know. The new library structure
# is too nice to port useless extra indexes.

    for (elem in _acpi)
        _ops_index[elem] = _acpi[elem]

    for (elem in _datetime)
        _ops_index[elem] = _datetime[elem]

    for (elem in _media)
        _ops_index[elem] = _media[elem]

    for (elem in _mem)
        _ops_index["MEM" elem] = _mem[elem]

    for (elem in _cpu)
        _ops_index["CPU" elem] = _cpu[elem]

    for (elem in _proc)
        _ops_index[elem] = _proc[elem]

    for (elem in _sensors)
        _ops_index[elem] = _sensors[elem]

    for (elem in _weather)
        _ops_index[elem] = _weather[elem]

    for (elem in _net)
        _ops_index[elem] = _net[elem]

    for (elem in _wifi)
        _ops_index["W" elem] = _wifi[elem]

    if (_translate == "POSIXSHELL")
    {
        for (elem in _ops_index) {
            shellstr = elem
            gsub(SUBSEP, "", shellstr)
            print shellstr "=" _ops_index[elem]
        }
    }
}

# vim:ft=awk:tw=60:
